﻿using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace ShootLife2D.Helpers
{
    public static class GraphicsPrimitivesHelper
    {
        public static Texture2D CreateFilledRectangle(int width, int height, Color fillColor, GraphicsDevice gd)
        {
            Texture2D rectangleTexture = new Texture2D(gd, width, height, false, SurfaceFormat.Color);// create the rectangle texture, ,but it will have no color! lets fix that
            Color[] color = new Color[width * height];//set the color to the amount of pixels in the textures
            for (int i = 0; i < color.Length; i++)//loop through all the colors setting them to whatever values we want
            {
                color[i] = fillColor;
            }
            rectangleTexture.SetData(color);//set the color data on the texture
            return rectangleTexture;//return the texture
        }
    }
}